package org.alex.samples.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.LockOptions;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.criterion.DetachedCriteria;

public interface IBaseDao<T> {
	
	public void flush();
	
	public T get(Serializable id);

	public T getWithLock(Serializable id, LockOptions lockOptions);

	public T load(Serializable id);

	public T LoadWithLock(Serializable id, LockOptions lockOptions);

	public List<T> loadAll();

	public void update(T entity);

	public void save(T entity);

	public void saveOfUpdate(T entity);

	public void save(Collection<T> entities);

	public void delete(T entity);

	public void deleteByKey(Serializable id);

	public void deleteAll(Collection<T> entities);

	public List<T> find(String queryString);

	public List<T> find(String queryString, Object[] objects);

	public Iterator<T> iterate(String queryString);

	public Iterator<T> iterate(String queryString, Object[] objects);

	public void closeIterator(Iterator<T> iterator);

	public T queryForObject(final String hql, final Object[] params);

	public T queryForTopObject(String hql, Object[] objects);

	public List<T> queryForList(final String hql, final Object[] objects);

	public List<T> queryForList(final String hql, final Object[] objects, final int recordNum);

	public DetachedCriteria createDetachedCriteria();

	public Criteria createCriteria();

	public Query createQuery(final String queryString);

	public Query createQuery(final String hql, final Object[] params);

	public SQLQuery createSqlQuery(String queryString);
}
